<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var hundreds, tens, ones, newNum;
        for (var i = 100; i < 1000; i++) {
            hundreds = parseInt(i / 100);
            tens = parseInt(i % 100 / 10);
            ones = i % 10;
            // Math.pow(x,y) ，返回 x 的 y 次幂的值
            newNum = Math.pow(hundreds, 3) + Math.pow(tens, 3) + Math.pow(ones, 3);
            if (i == newNum) {
                document.write(newNum + "<br/>");
            }
        }
        // var num = Number(prompt("请输入："));
        // hundreds = parseInt(num / 100);
        // tens = parseInt(num % 100 / 10);
        // ones = num % 10;
        // document.write(hundreds + " " + tens + " " + ones + " ");
        // newNum = Math.pow(hundreds, 3) + Math.pow(tens, 3) + Math.pow(ones, 3);
        // document.write(newNum + "<br/>");
    </script>
</head>

<body>

</body>

</html>